import 'dart:async';
import '../device_service.dart';

class WifiDeviceService implements IDeviceService {
  final _discoveryCtrl = StreamController<List<DiscoveredDevice>>.broadcast();
  final _statusCtrl = StreamController<DeviceStatus>.broadcast();

  @override
  Future<void> startDiscovery() async {
    _discoveryCtrl.add(const []);
  }

  @override
  Stream<List<DiscoveredDevice>> get discovery$ => _discoveryCtrl.stream;

  @override
  Future<void> connect(String deviceId) async {
    _statusCtrl.add(const DeviceStatus(connected: true));
  }

  @override
  Future<void> disconnect() async {
    _statusCtrl.add(const DeviceStatus(connected: false));
  }

  @override
  Future<void> sendCommand(String code, value) async {}

  @override
  Stream<DeviceStatus> get status$ => _statusCtrl.stream;
}
